package cn.hwadee.muying.service;

import cn.hwadee.muying.entity.WorkerInfo;
import cn.hwadee.muying.mapper.WorkerInfoMapper;
import cn.hwadee.muying.commons.base.BaseService;
import org.springframework.stereotype.Service;
import cn.hwadee.muying.entity.User;
import cn.hwadee.muying.commons.page.MyPage;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

/**
 * <p>
 * 职员信息 服务实现类
 * </p>
 *
 * @author Mankind
 * @since 2018-08-06
 */
@Service
public class WorkerInfoService extends BaseService<WorkerInfoMapper, WorkerInfo> {

    @Autowired
    private WorkerInfoMapper workerInfoMapper;


    public MyPage<WorkerInfo> list(MyPage<WorkerInfo> page, User cUser) throws Exception{
        List<WorkerInfo> workerInfos = workerInfoMapper.list(page,cUser);
        page.setRecords(workerInfos);
        return page;
    }

    public WorkerInfo selectByUserId(Long userId) {
        return workerInfoMapper.selectByUserId(userId);
    }

    public void deleteByUserId(Long userId) {
        workerInfoMapper.deleteByUserId(userId);
    }
}
